
/*
 * GET home page.
 */

/*
exports.index = function(req, res){
  res.render('index', { title: 'Express' });
};
*/

var index_handlers = require("./index_handlers.js");
var user_handlers = require("./user_handlers.js");
var router = require("./router.js");
var user_stats_helper = require("./user_stats_helper.js");
var allies = require("./allies.js");


var Router = router.Router;
var POST   = router.POST;
var GET    = router.GET;


var routes = new Router(allies);

/*
//reg all the handlers

routes.reg("/",user_stats_helper,GET);
routes.reg("/",index_handlers.homepage_handler,GET);

routes.reg("/reg",index_handlers._checkNotLogin,GET);
routes.reg("/reg",index_handlers.reg_handler,GET);

routes.reg("/reg",index_handlers._checkNotLogin,POST);
routes.reg("/reg",index_handlers._reg_handler,POST);

routes.reg("/login",index_handlers._checkNotLogin,GET);
routes.reg("/login",index_handlers.login_handler,GET);

routes.reg("/login",index_handlers._checkNotLogin,POST);
routes.reg("/login",index_handlers._login_handler,POST);

routes.reg("/logout",index_handlers._checkLogin,GET);
routes.reg("/logout",index_handlers.logout_handler,GET);

routes.reg("/user",index_handlers._checkLogin,GET);
routes.reg("/user",user_stats_helper,GET);
routes.reg("/user",user_handlers.setting_handler,GET);

routes.reg("/user",index_handlers._checkLogin,POST);
routes.reg("/user",user_handlers._setting_handler,POST);	   

//error path handling
//handle the 404 error for anything other than previous get.
//routes.reg("*",function(req,res){ res.send("wtf>>");},GET);
//routes.reg("*",function(req,res){ res.send("wtf>>");},POST);

*/

//exports routes.
module.exports = routes;
